import express from 'express';
import cors from 'cors';
import dotenv from 'dotenv';
import connectDB from './config/db';
import userRoutes from './routes/userRoutes';
import workRoutes from './routes/workRoutes';
import teamRoutes from './routes/teamRoutes';

dotenv.config();

connectDB();

const app = express();
const PORT = process.env.PORT || 5000;

app.use(cors());
app.use(express.json());

app.use('/api/users', userRoutes);
app.use('/api/works', workRoutes);
app.use('/api/teams', teamRoutes);

app.listen(PORT, () => console.log(`Server is running on port ${PORT}`));